#ifndef ODEFINES_H
#define ODEFINES_H


	#ifndef iteratorLoop
		#define iteratorLoop( arg ) typeof( arg.begin() ) it = arg.begin() ; it != arg.end() ; ++it
	#endif
	
	#ifndef iteratorLoop2
		#define iteratorLoop2( arg, arg2 ) typeof( arg.begin() ) arg2 = arg.begin() ; arg2 != arg.end() ; ++ arg2 
	#endif
	
	#ifdef pvar
		#undef pvar
	#endif
	
	#ifndef pvar
		#define pvar( arg ) Printer() << #arg ": " << arg
	#endif
	
	#ifndef FUNC
		#define FUNC(arg1,arg2,...) (void (Entity::*) ( __VA_ARGS__ )) (void (arg1::*) ( __VA_ARGS__ )) & arg1::arg2
	#endif
	
	#ifndef begin_iterator
		#define begin_iterator(arg,arg2) typeof( arg.begin() ) arg2 = arg.begin()
	#endif
	
	#ifndef create_iterator
		#define create_iterator(arg) typeof( arg.begin() )
	#endif
	
	#ifndef CH
		#define CH(arg0,arg1,arg2) if ( cv[i].name.lenientEquals(arg0) ){ arg1 = cv[i].to< arg2 >();handled(); }
	#endif
	
	#ifndef CONNECT_SIGNALS
		#define CONNECT_SIGNALS( w1,s1,w2,s2 ) w1->connect(s1,w2,FUNC(Entity,call,const char *),s2)
	#endif

	#ifndef FLUSH
		#define FLUSH std::cout.flush()
	#endif
	
namespace Y{	
	
	enum DrawingFlags {	NO_BACKGROUND = 1 << 0, PARENT_BOUNDS_INDEPENDENT = 1 << 1, BOUNDS_INDEPENDENT = 1 << 2};
	
	enum EventType {	MOUSE_PRESS = 1 << 0, MOUSE_RELEASE = 1 << 1, MOUSE_MOVE = 1 << 2, MOUSE_DRAG = 1 << 3,
						MOUSE_SCROLL = 1 << 4, KEY_PRESS = 1 << 5, KEY_RELEASE = 1 << 6, FOCUS = 1 << 7,
						MOUSE_ENTER = 1 << 8, MOUSE_EXIT = 1 << 9, EXIT_EVENT = 1 << 10, ENTER_EVENT = 1 << 11				};
	
	enum OperatingSystems { MAC, WINDOWS, LINUX };
	
	enum { O_CTRL = 1 << 0 , O_CMND = 1 << 1 , O_SHIFT = 1 << 2 , O_ALT = 1 << 3, O_OPTION = 1 << 3 };
	enum { CTRL = 1 << 0 , CMND = 1 << 1 , SHIFT = 1 << 2 , ALT = 1 << 3, OPTION = 1 << 3 };
	#define O_KEY_UP 250
	#define O_KEY_DOWN 251
	#define O_KEY_LEFT 252
	#define O_KEY_RIGHT 253
	
	#define scase break;case
	#define ocase break;case
	
	
	enum Alignments			{ TOP_LEFT, TOP_RIGHT, CENTER, RIGHT, LEFT, TOP, BOTTOM };
	
	struct ltstr{bool operator()(const char* s1, const char* s2) const{return strcmp(s1, s2) < 0;}};
	
	
	enum OPrimType	{ O_POINTS, O_LINES, O_TRIANGLES, O_QUADS };
	

	enum OTypes		{	
							//Empty constant
							O_empty,						//0
							//Not real held data, placeholders
							O_ExpressionOperator,				//1
							O_ExpressionFunction,				//2
							O_ExpressionVariable,				//3
							O_ExpressionOEDC,					//4
							O_ExpressionComponent,				//5
							O_SubExpression,					//6
							O_Initializer,						//7
							//Real, tangible data types
							O_int,								//8
							O_float	,						//9
							O_bool,								//10
							O_object,							//11
							O_string,							//12
							O_ptr,								//13
							O_var,								//14
							O_EDC,								//15
							O_function,							//16
							O_var_address,						//17
							O_edc_address,						//18
							O_built_in_function,				//19
							//Synonyms
							O_unknown = O_empty,
							O_NULL_ = O_empty,
							O_void_ = O_empty ,
							O_variable_ = O_var,
							O_OEDC_ = O_object,
							O_PTR_MASK = 128,
							O_BUILTIN_FUNCTION_MASK = 1 << 30
						};

}

#endif
